home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / os2 / hed151b.zip / hed.doc < prev    next >
Text File  |  1996-10-18  |  13KB  |  424 lines

  1.  
  2.                            Hed version 1.51 beta
  3.  
  4.                         Brief manual (in beta also)
  5.                   
  6.  
  7.  
  8.  
  9.  
  10.                            HED KEY REFERENCE
  11.  
  12.  
  13.  Alt-O          Open file. A wildcard will open all the matching
  14.                 files. Logical drives (partitions) can be opened
  15.                 as well by specifying the drive letter followed
  16.                 by a semicolon (e.g. 'D:').
  17.  
  18.  Alt-Q          Quit file.
  19.  
  20.  Alt-N          Next file.
  21.  
  22.  Alt-P          Previous file. Hed can open multiple files. Use
  23.                 Alt-N, Alt-P to browse through these files.
  24.  
  25.  F3             Abort changes in file.
  26.  
  27.  F2             Save file (write changes).
  28.  
  29.  Alt-F2         Save as under a different filename.
  30.  
  31.  
  32.  
  33.  F9             Shell to command prompt.
  34.  
  35.  Alt-F9         Execute program.
  36.  
  37.  Alt-X          Exit.
  38.  
  39.  
  40.  
  41.  Home           Move at the beginning of the file.
  42.  
  43.  End            Move at the end of the file. An additional right
  44.                 arrow is required to move past the end of the
  45.                 file.
  46.  
  47.  Ctrl-RArrow    Slide the panel to the right.
  48.  
  49.  Ctrl-LArrow    Slide the panel to the left.
  50.  
  51.                 NOTE: When in disassembly mode, hed will always
  52.                 try to find the original stream of code so as
  53.                 to avoid placing the panel's start in between
  54.                 instructions. Sliding the panel left or right
  55.                 is useful when needed to go to an exact location
  56.                 (e.g. in the middle of an instruction).
  57.  
  58.  Alt-G          Go to offset.
  59.  
  60.                 NOTE: Hed accepts arithmetic expressions in any
  61.                 number requester. So, instead of a number you can
  62.                 enter complex expressions. For example:
  63.                 0x100+345*(1<<8).
  64.  
  65.  Ctrl-B         Go back to previous position (undo last goto).
  66.  
  67.  Alt-Shf[0...9] Save position.
  68.  
  69.  Alt-[0...9]    Return to position.
  70.  
  71.  Alt-PgDwn      Go to next change. Will jump to the next byte that has
  72.                 been previously changed. This is useful to keep track
  73.                 of changed data in various places of a large file.
  74.  
  75.  Alt-PgUp       Go to previous change.
  76.  
  77.  
  78.  
  79.  
  80.  Tab            Switch between ascii and hex panels in normal
  81.                 mode. Switch between hex and instructions while
  82.                 in disassembly mode.
  83.  
  84.  Alt-V          Toggle between hexadecimal and disassembly mode.
  85.  
  86.  Alt-D          Toggle between hexadecimal and decimal offset
  87.                 representation.
  88.  
  89.  Alt-F          Select text filter.
  90.  
  91.  Alt-U          Toggle segment size (16bits or 32bits). This will change
  92.                 the mode the internal assembler and disassembler works.
  93.                 For more information look at "Assembling and Disassembling"
  94.                 section.
  95.  
  96.  
  97.  +              Increase number at cursor location.
  98.  
  99.  -              Decrease number.
  100.  
  101.  Del            Undo byte.
  102.  
  103.  Backspace      Move backwards and undo.
  104.  
  105.  Alt-Enter      Insert number at cursor location. The inserted
  106.                 expression will be evaluated and will be placed
  107.                 at the cursor location as a 8, 16 or 32bit number.
  108.  
  109.  F11            Insert character. Selects a character from the
  110.                 ascii character table.
  111.  
  112.  Ctrl-Ins       Copy to Hed's internal clipboard. To select data
  113.                 for copying hold down the Shift key while moving.
  114.                 Data from the clipboard can be pasted into the
  115.                 data panel or in the dialog boxes.
  116.  
  117.  Shift-Ins      Paste from internal clipboard.
  118.  
  119.  Alt-Ctrl-Ins   Copy selection to file. Data can be saved as
  120.                 binary, hex or disassembly.
  121.  
  122.  Shift-Ctrl-Ins Paste file into current location.
  123.  
  124.  Ctrl-Del       Undo all changes within selection.
  125.  
  126.  
  127.  F5             Find number.
  128.  
  129.  F6             Find text string.
  130.  
  131.  F7             Find hexadecimal data.
  132.  
  133.  F8             Super find. For details about finding look at
  134.                 'Finding & Replacing' section of this documentation.
  135.  
  136.  Alt-F5         Find number and replace.
  137.  
  138.  Alt-F6         Find text and replace.
  139.  
  140.  Alt-F7         Find hex and replace.
  141.  
  142.  Alt-F8         Super find and replace.
  143.  
  144.  
  145.  Shift-F7       Redo last search.
  146.  
  147.  
  148.  Ctrl-F4        Calculator.
  149.  
  150.  Ctrl-M         Record Macro.
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.                          FINDING & REPLACING
  160.  
  161.  
  162.  Find hex:
  163.  
  164.  Finds hex data in the file. Enter the hex data to search for or
  165. paste it from the internal clipboard. The keystroke Alt-? will
  166. insert a wildcard. A wildcard in the search pattern matches any
  167. data. A wildcard in the replace pattern will leave anafected the
  168. replaced byte.
  169.  
  170.  
  171.  Finds texts:
  172.  
  173.  Finds text in the file. Case sensitive or insensitive searches
  174. can be specified. Wildcards can be used in a similar way.
  175.  
  176.  
  177.  Find number:
  178.  
  179.  Finds a number in the file. Dword words or byte sizes may be
  180. specified. HeD uses the little endian notation of the x86 chips.
  181. That is, the bytes are written in memory in order of significance.
  182. For example the number 0x1344 is encoded as 44 13. A number or
  183. an expression can be inserted here.
  184.  
  185.  
  186.  Super find:
  187.  
  188.  Superfind is an advanced more flexible way of searching for
  189. data. The search expression consists of a series of wildcards,
  190. each for every byte, separated by a space character.
  191.  
  192.  Wildcards use the ? - [ ] , ! symbols much in the same way used
  193. by the unix shell. The following examples will clarify the use of
  194. these wildcards.
  195.  
  196.   1? 3E 44
  197.  
  198.    This expression will match a string that has the first
  199.   hex number of the first byte equal to 1 and a second and
  200.   third byte of 3E and 44.
  201.  
  202.    E8 [0-100d]
  203.  
  204.    The first byte should equal E8 (hex) and the second must
  205.   be in the range of 0 to 100 (decimal).
  206.  
  207.    90 !90
  208.  
  209.    The first byte should equal 90h while the second must
  210.   not equal 90h
  211.  
  212.    1B
  213.  
  214.    Search for 01, not 1B ! The trailing b indicates the
  215.   number is binary.
  216.  
  217.    ???????0b ???????1b
  218.  
  219.    Search for an even number immediately followed by an
  220.   odd number.
  221.  
  222.      1?1d
  223.  
  224.    Matches all decimal numbers having a first and last
  225.   digit of 1.
  226.  
  227.    ![3,5,[10-34]]
  228.  
  229.    Number should not be 3, 5 or in the range of 10 (hex)
  230.   to 34 (hex)
  231.  
  232.  
  233.   NOTE: Replace data in super find is simple hex data.
  234.  
  235.  
  236.  
  237.   Find Reference:
  238.  
  239.  Searches the file for branch reference to a specified offset
  240. or to the current location if no offset is specified (use this
  241. if the cursor is at the beginning of a function). The first
  242. call to Find Reference will always start from the beginning of
  243. the file. Subsequent calls (Shift-F7) will continue the search
  244. from the last found reference.
  245.  
  246.  The algorithm Find Reference is using is quite simple and it
  247. is based on two simple rules of 386 assembly: the branch offset
  248. is always the last data encoded in a x86 instruction and that
  249. the branch offset is added to the offset of the _next_ instruction.
  250. So Find Reference simply searches for numbers (of the specified
  251. size) whose value added to the offset of the byte following the
  252. number sums up to the requested offset.
  253.  
  254.  In addition find reference can check if the previous byte of
  255. the number found is a valid opcode of a branch instruction (jmp,
  256. call etc).
  257.  
  258.  
  259.  
  260.  
  261.  
  262.                               LX PARSING
  263.  
  264.  One of the most powerful features of hed is its ability to read
  265. the OS/2's executables headers thus providing a much more flexible
  266. debugging and code tracing environment. To parse an executable
  267. headers simply select 'load LX fixup' from the 'Fixups' menu or
  268. enable the autoloadfixups directive in hed.cfg.
  269.  
  270.  Hed will use the information obtained from the LX tables to
  271. resolve and correctly display instruction containing fixups while
  272. in disassembly. In addition, lists of all the fixups, exports and
  273. imports can be browsed from the 'Fixups' menus. These are:
  274.  
  275.       Imported names:
  276.  
  277.     A list of data (or function entry points) imported by name. Each
  278.   entry has the following form:
  279.  
  280.     <offset>  <modulename>.<entryname>+<offset>.
  281.  
  282.    <offset> is the offset within the current file where the import
  283.   is requested. <modulename> is the internal name of the module
  284.   containing the requested data.  <entryname> is the name used
  285.   to export the data and <offset> is optional offset from the
  286.   beggining of the data.
  287.  
  288.  
  289.       Imported ordinals:
  290.  
  291.     A list of data imported by ordinal. Each entry in the listing has
  292.   the following form:
  293.  
  294.     <offset>  <modulename>.<ordinal>
  295.  
  296.    <offset> is the offset of the import. <modulename> is the internal
  297.   name of the module containing the imported data. <ordinal> is a number
  298.   (unique within the specified module) that selects a specific export.
  299.  
  300.  
  301.       Internal references:
  302.  
  303.     A list of internal fixups. This usually for cross-object branches
  304.   and global data referencing. The format of the entries is
  305.  
  306.     <offset>  <target>
  307.  
  308.    <offset> as usual is the offset of the fixup and <target> is the
  309.   actual number used in this location.
  310.  
  311.  
  312.       Internal references by ordinal:
  313.  
  314.     The same as 'internal references' only that this time the target
  315.   is selected using an index into the exported ordinal table of the
  316.   current module instead of an offset.
  317.  
  318.  
  319.       Exported ordinals:
  320.  
  321.     A table of exported entry points labeled by a unique number (ordinal).
  322.   Entries in this table have the following form:
  323.  
  324.     <ordinal>  <offset>
  325.  
  326.    <ordinal> is the ordinal number of this export and <offset> is the
  327.   offset of this export from the beggining of the file.
  328.  
  329.  
  330.       Exported names:
  331.  
  332.     A table of entry points exported by name. Instead of ordinal numbers
  333.    a complete ascii string is used. Note however that this export do
  334.    have an ordinal number as well.
  335.  
  336.  
  337.  While browsing any of this menus pressing enter will jump to the
  338. appropriate offset. If any of this menus is not available then the
  339. corresponding table is not present in the LX header of the binary.
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.                     DISASSEMBLING & ASSEMBLING
  347.  
  348.  
  349.  Hed has build in assembling and Disassembling capabilities. Pressing
  350. Alt-V at any time will switch between hex and disassembling mode.
  351.  
  352.  Hed uses tasms and masm opcode representation. That is the target goes
  353. first and sizes are denoted using 'byte ptr', 'word ptr' and 'dword ptr'
  354. prefixes. A thorough explanation of the 386 instruction encodings is
  355. beyond the scope of this documentation. It is assumed that the user will
  356. have some experience with TD, tasm or masm.
  357.  
  358.  Some additional explanation is required on branches (jumps, calls, jump
  359. under conditions etc). Relative branch targets are calculated and shown as
  360. file offsets. That is the offset shown in a jump statement is not the
  361. actual number that will appear when the module is loaded but it is the
  362. offset within the file where the instruction points to. Effectively,
  363. pressing enter on a branch statement will jump to the target location.
  364. In addition hed can also follow far inter-object fixed branches using
  365. the information in the LX header (of course LX fixups must first be
  366. loaded).
  367.  
  368.  To enter instructions press space or simply start typing the
  369. instruction and the appropriate dialog will pop up. Hex data can be
  370. entered as well by pressing tab.
  371.  
  372.  
  373.  
  374.  
  375.  
  376.                    KNOWN BUGS / KNOWN LIMITATIONS
  377.  
  378.  
  379.  Limitations and bugs known to the author. Most of these will be
  380. corrected in feature versions:
  381.  
  382.  
  383. - Hed's hex panel is hardwired to 16*16.
  384.  
  385. - Hed's disassembly panel is hardwired to 16 chars height.
  386.  
  387. - Hed can't assemble floating point instructions.
  388.  
  389. - Replacing routines aren't really optimized. Mass replaces of
  390. very frequent appearing data can take quite a long time.
  391.  
  392. - Hed can't execute files that are currently being edited. This
  393. really happens because hed opens all files with deny-both sharings.
  394.  
  395. - Copying to a file as disassembly text will not include fixup
  396. informations.
  397.  
  398. - Opcode checking in find reference will not match long conditional
  399. jumps . Only short (8bit) conditional jumps will be mathced.
  400.  
  401.  
  402.  
  403.                            ACKNOWLEDGMENTS
  404.  
  405.  
  406.  Panagiotis Malakoudis. The official hed beta tester :). Cracking
  407. programs has never been more inspiring.
  408.  
  409.  Peter Fitzsimmons for helping me on a OS/2 programming issue.
  410.  
  411.  All the guys in Team OS/2 Greece for their support.
  412.  
  413.  All of you out there in the internet who send me bug reports
  414. and requests for new features.
  415.  
  416.  
  417. .
  418.  
  419.  
  420.  
  421.  Dimitris Kotsonis
  422.  jnk@hol.gr
  423.  
  424.